<ion-view title="员工管理" show-tabs>

  <ion-nav-buttons side="right">
    <a class="button button-icon icon ion-android-add" ui-sref="app.employee-add" ng-if="sysUserCount < company.users_num"></a>
  </ion-nav-buttons>

  <ion-content class="has-header">
    <section class="wrap-light">
      <ion-item class="item-icon-left item-borderless">
         <i class="icon ion-ios-people-outline dark2"></i>
         在职：<span class="balanced">{{employees.length || 0}}</span> 人
      </ion-item>
      <ion-item class="item-icon-left item-borderless">
         <i class="icon ion-log-in dark2"></i>
         启用账号：<span class="balanced">{{sysUserCount || 0}}</span> / {{company.users_num || 0}}
      </ion-item>
    </section>

    <ion-list can-swipe="listCanSwipe" show-delete="showEdit" class="editable-list user-list">

      <ion-item class="item-avatar" ng-repeat="employee in employees" href="#/employee-{{employee._id}}">
        <ion-delete-button class="icon ion-minus-circled" ng-click="delete($index)"></ion-delete-button>
        <img ng-src="" ng-if="employee.profile.avatar">
        <i class="item-image icon ion-person" ng-class="{'positive': employee.profile.sex=='男','cute': employee.profile.sex=='女'}" ng-if="!employee.profile.avatar"></i>
        <i class="icon" ng-class="{'ion-male positive': employee.profile.sex=='男','ion-female cute': employee.profile.sex=='女'}"></i>
        <h2>
          {{employee.profile.name}} <span ng-if="employee.profile.state=='请假'"> - {{employee.profile.state}}</span>
          <span class="item-note">{{employee.username}}</span>
        </h2>
        <p>
          <span ng-repeat="dept in employee.profile.departments">{{dept.name}}</span>
          <span class="item-note">{{employee.profile.roleName}}</span>
        </p>
        <ion-option-button class="button-balanced" ng-click="makeCall(employee)"><i class="icon ion-ios-telephone-outline padding-right"></i>拨号</ion-option-button>
        <ion-option-button class="button-positive" ng-click="notify(employee)">易信</ion-option-button>
      </ion-item>
    </ion-list>
    <p class="padding-top text-center dark2">操作 : 左滑列表项可更改或删除 </p>
  </ion-content>
</ion-view>
